#!/usr/bin/env python3

from src import main_scene_cut
from src import main_read_file
import TikTokDownloader
from src import move_folder_contents
from src import ExecuteSqlFile
import os

if __name__ == '__main__':
    # 新需求改动，每次提交后存储已下载的链接到配置文件，并且以后每次爬取，都需要更新以前的代码
    TikTokDownloader.TikTokDownloader().run()
    # 视频场景分剪 使用多线程的方式来提升速度
    cutServer = main_scene_cut.CutServer(video_path='video', clip_path='clip',max_workers = 1)
    cutServer.run()
    # 读取视频封面并保存到视频的目录的scene文件夹中
    main_read_file.main()
    # 读取完成后转移文件
    move_folder_contents.main(source_folder='clip', destination_folder='G:\\clip')
    move_folder_contents.main(source_folder='video', destination_folder='G:\\video')
    # 执行sql
    ExecuteSqlFile.executeSqlFile("sql/douyin_file.sql")
    ExecuteSqlFile.executeSqlFile("sql/douyin_video_basic.sql")
    ExecuteSqlFile.executeSqlFile("sql/douyin_video_file.sql")
    ExecuteSqlFile.executeSqlFile("sql/v1_DDL.sql")
